﻿@{
    ViewBag.Title = "电子会员卡二维码";
}

<style type="text/css">
    body {
        overflow:auto !important;
    }
			.main {
				width: 100%;
				height: 100%;
				display: flex;
				flex-wrap: wrap;
				/*justify-content: space-around;*/
			}
			.box-min {
				width: 350px;
				height: auto;
				margin: 20px;
				/*border: 2px solid #000;*/
			}
			.box {
				width: 350px;
				height: 480px;
				border-radius: 10px;
				/*background: url(../QRCode/ShopQRCode.png) no-repeat;*/
				background-size: 100% 100%;
				box-shadow: 0 0 1px 2px #000;
				position: relative;
			}
	
			.box-min h4 {
				text-align: center;
				color: #000;
				margin: 0;
				padding: 15px 0;
                font-family:宋体;
                font-size:11pt;
			}
			
			.box img {
				display: block;
				/*background: #fff;*/
				border-radius: 10px;
				position: absolute;
				/*top: 80px;
				left: 60px;
				width: 223px;
				height: 240px;*/
			}
			
			.box .ramadhin {
				display: block;
				text-align: center;
				color: #000;
				font-size: 26px;
			}

            .box img {
        		width: 350px;
				height: 480px;
            }
		</style>

        <div name="Base" style="height:30px;overflow:hidden;margin-top:10px;margin-left:2px">
            <table>
                <tr>
                    <td width="100px" align="right">二维码类型：</td>
                    <td width="300px" >
                         <input id="combo1" class="mini-combobox" style="width:200px;margin-top:1px;margin-left:1px" textField="FName" valueField="FItemID"
                            value="0" allowInput="false"  showNullItem="false" onvaluechanged="TypeChange"/> 
                    </td>
                </tr>
            </table>
        </div>




		<div class="main">
            @{
                System.Collections.ArrayList list = (@ViewBag.mData as System.Collections.ArrayList);
                if (list != null)
                {
                    foreach (System.Collections.Hashtable dr in list)
                    {
                        <div class="box-min">
			                <div class="box">
				                <img class="" id="" src="@dr["FileUrl"].ToString()" />
			                </div>
				            <h4>@dr["FStockName"].ToString()</h4>
                        </div>	
                    }
                }
            }
		</div>

<script>
    var QCodeType = [{ "id": "0", "text": "会员卡二维码" },
        { "id": "1", "text": "营销二维码" }, { "id": "2", "text": "商城二维码" }];

    mini.parse();
    getQCodeType();
    

    function getQCodeType() {
        mini.get("combo1").setUrl('GetQCodeType?mjson=' + parent.window.getSystemAppID());
        if (mini.get("combo1").data.length > 0) {
            mini.get("combo1").select(0);
            TypeChange();
        }
    }

    function TypeChange() {
        var type = mini.get("combo1").getValue();
        if (type > -1) {
            mini.mask({
                el: document.body,
                cls: 'mini-mask-loading',
                html: '二维码加载中, 请稍等......'
            });
            $.post("getQRcodes", { AppID: parent.window.getSystemAppID(), Type: type }, function (data) {
                var Data = mini.decode(data);
                var html = '';
                for (var i = 0; i < Data.length; i++) {
                    html = html + '<div class="box-min"><div class="box"><img class="" id="" src="' + Data[i].FileUrl + '?' + Math.random() + '"'
                        + ' /></div><h4>' + Data[i].FStockName + '</h4></div>';
                }
                $(".main").empty();
                $(".main").append(html);
                mini.unmask(document.body);
            });
        } else {
            $(".main").empty();
        }
    }
</script>